<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
	<ui:composition template="/templates/padrao.xhtml">
		<ui:define name="barraTitulo">Cadastro de Cliente</ui:define>
		<ui:define name="conteudo">
			<p:growl id="messages"/>
			<h:form id="form">
				<p:tabView id="divTabView">
					<p:tab title="Cadastro">					
						<h:panelGrid columns="3" columnClasses="width150 alinhaDir, width500">
							<h:outputText value=""/>
							<h:outputText value="Os campos com asterisco (*) s&atilde;o de preenchimento obrigat&oacute;rio." styleClass="campoObrigatorio" />
							<h:outputText value=""/>
							
							<h:outputText value="Tipo Cliente:" styleClass="alinhaDir"/>							
							<h:selectOneMenu value="#{controleCliente.cliente.tipo}"  required="true" >
                                <f:selectItem var="cliente" itemLabel="selecione" itemValue=""/>							  
				            	<f:selectItems value="#{controleCliente.tiposCliente}" var="tipo" itemLabel="#{tipo}" itemValue="#{tipo}" />
							</h:selectOneMenu>
							<h:outputText value=""/>
														
							<h:outputText value="CPF / CNPJ:" styleClass="alinhaDir"/>	
							<h:column>							
								<h:inputText  value="#{controleCliente.cliente.CPF_CNPJ}" requiredMessage="Campo [CPF / CNPJ] obrigat&oacute;rio" size="20"/>
								<h:outputText value="&nsbp;  &nsbp; &nsbp;RG / IE: " styleClass="alinhaDir"/>
								<h:inputText  value="#{controleCliente.cliente.RG_IE}"  size="20"/> 
								<h:outputText value="&nsbp; UF RG / IE:&nbsp;" styleClass=""/>
								<h:selectOneMenu value="#{controleCliente.cliente.UFRG_IE}" requiredMessage="Campo [UF] obrigat&oacute;rio" required="true" >  
				                    <f:selectItems value="#{controleCliente.UFS}" var="UF" itemLabel="#{UF}" itemValue="#{UF}" />
								</h:selectOneMenu>
								<h:outputText value="(*)" styleClass="campoObrigatorio" />&nbsp; 
				            </h:column>
				            <h:outputText value=""/>
							
							<h:outputText value="Nome:" styleClass=""/>							
							<h:inputText  value="#{controleCliente.cliente.nome}" requiredMessage="Campo [NOME] obrigat&oacute;rio" size="50"/>
							<h:outputText value=""/>
							<h:outputText value="Telefone:" styleClass=""/>
							<h:column>							
								<p:inputMask id="telefone" size="14" mask="(99) 9999-9999" maxlength="14" value="#{controleCliente.cliente.telefone}" requiredMessage="Campo [TELEFONE] obrigat&oacute;rio" required="true" />
								<h:outputText value=""/>
								<h:outputText value="&nsbp; Celular: " styleClass=""/>							
								<p:inputMask id="celular" size="14" mask="(99) 9999-9999" maxlength="14" value="#{controleCliente.cliente.celular}" alt="phone" />
							</h:column>
							<h:outputText value=""/>							
							<h:outputText value="Email:" styleClass=""/>
							<h:inputText id="email" size="50" maxlength="50" value="#{controleCliente.cliente.email}" class="lower" />
							<h:outputText value=""/>
							
							<h:outputText value="CEP:" styleClass=""/>							
							<p:inputMask id="CEP" size="12" mask="99999-999" maxlength="9" value="#{controleCliente.cliente.endereco.CEP}" requiredMessage="Campo [CEP] obrigat&oacute;rio" required="true"/>
							<h:outputText value="" styleClass="" />							
							<h:outputText value="Endere&ccedil;o:" styleClass=""/>
							<h:column>	
								<h:inputText id="logradouro" size="50" maxlength="80" value="#{controleCliente.cliente.endereco.logradouro}" requiredMessage="Campo [ENDERE&Ccedil;O] obrigat&oacute;rio" required="true" class="upper" />
								<h:outputText value="" styleClass="" />	
								<h:outputText value="&nbsp; N&uacute;mero:&nbsp;" styleClass=""/>
								<h:inputText id="numero" size="10" maxlength="10" value="#{controleCliente.cliente.endereco.numero}" requiredMessage="Campo [N&Uacute;MERO] obrigat&oacute;rio" required="true" class="upper" />
							</h:column>													
							<h:outputText value="" styleClass="" />
							
							<h:outputText value="Complemento:" styleClass=""/>												
							<h:inputText id="complemento" size="50" maxlength="50" value="#{controleCliente.cliente.endereco.complemento}" class="upper" />							
							<h:outputText value="" styleClass="" />
							
							<h:outputText value="Bairro:" styleClass="" />
							<h:inputText id="bairro" size="80" maxlength="100" value="#{controleCliente.cliente.endereco.bairro}" requiredMessage="Campo [BAIRRO] obrigat&oacute;rio" required="true" class="upper" />
							<h:outputText value="" styleClass="" />
							
							<h:outputText value="Cidade:" styleClass="" />
							<h:column>
								<h:inputText id="cidade" size="60" maxlength="100" value="#{controleCliente.cliente.endereco.cidade}" requiredMessage="Campo [CIDADE] obrigat&oacute;rio" required="true" class="upper" />								
								<h:outputText value="&nsbp; UF:&nbsp;" styleClass=""/>
								<h:selectOneMenu value="#{controleCliente.cliente.endereco.UF}" requiredMessage="Campo [UF] obrigat&oacute;rio" required="true" >  
				                    <f:selectItems value="#{controleCliente.UFS}" var="UF" itemLabel="#{UF}" itemValue="#{UF}" />
								</h:selectOneMenu>
								<h:outputText value="(*)" styleClass="campoObrigatorio" />&nbsp;
							</h:column>
							<h:outputText value=""/>
							<h:outputText value="Imagem / Logo:" styleClass=""/>
							<h:column>
								<p:panel id="id_logoCliente">
									<h:column>
										<h:graphicImage url="#{controleCliente.imagemCliente}" rendered="#{not empty controleCliente.cliente.nomeImagem}"/>
									</h:column>
								</p:panel>
							</h:column>
							<h:outputText value=""/>
							<h:outputText value=""/>
							<p:fileUpload 	fileUploadListener="#{controleCliente.fileUpload}"  
											multiple="false" 
											auto="true" 
											label="Uploads" 
											update="id_logoCliente"
											allowTypes="*.jpg;" 
											description="fotos"/>
						</h:panelGrid>
					</p:tab>
				</p:tabView>				
				<h:commandLink action="#{controleCliente.gravar}" styleClass="alinhaDir">
					<h:graphicImage url="/images/botoes/btnGravar.png" class="btnAcoes"/>
				</h:commandLink>				
				<h:commandLink action="#{controleCliente.limpar}">
					<h:graphicImage url="/images/botoes/btnLimpar.png" class="btnAcoes"/>
					<f:ajax render="divTabView"/>
				</h:commandLink>	
				<h:outputLink value="manutencao.jsf">
					<h:graphicImage url="/images/botoes/btnPesquisar.png" class="btnAcoes"/>
				</h:outputLink>
			</h:form>
		</ui:define>
	</ui:composition>
</html>